package com.cn.elite.nj;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;



public class test1 {
	private static final Log log=LogFactory.getLog(test1.class);
	public static void main1(String[] args) throws IOException{
//		File f = new File("C:\\edi_ent_20130630_add.dat");
//		StringBuffer sb = new StringBuffer();
//		String s = null;
//		BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
//		System.out.println("start");
//		while ((s = br.readLine()) != null) {
//			sb.append(s);
//		}
//		String a=sb.toString();
//		System.out.println("len:"+a.split("\\|+\\|").length);
		
		String a="1,2,,,";
		System.out.println(a.indexOf(","));
	    
	}
	
	public static List getList(String a,String b){
		List<String> list = new ArrayList<String>();
		int k= a.length(); 
		int m=0;
		for (int i = 0; i < a.length(); i++){
			if (a.substring(i, i + 1).equals(b)){
				String L=a.substring(m,i).trim();  
				list.add(L);
			    m=i+1;
			}
			if(i==a.length()-1){
				   if(a.substring(i-1, i).equals(b)){
					   list.add("");
				   }
			  }
		}
		return list;
	}
	public  static List<String> getList1(String a,String b){
		List<String> list = new ArrayList<String>();
		int k= a.length(); 
		int m=0;
		for (int i = 0; i <a.length()-2; i++){
			if (a.substring(i, i + 3).equals(b)){			
				String L=a.substring(m,i).trim();  			
				list.add(L);
			    m=i+3;
			}
		}
		String temp=a.substring(a.lastIndexOf(b)+3,a.length());
		System.out.println("a:"+temp);
		list.add(temp);
		return list;
	}
	public static void main(String args[]){
		Date startDate = new Date();
		System.out.println("调用client.doPost开始时间："+startDate.toString());
		List<String> list=getList1("四川省皓森数码科技有限公司四川省皓森数码科技有限公司|@|109020002|@|511300190000248717|@|四川省皓森数码科技有限公司|@||@||@||@||@||@||@||@||@||@||@||@|901000001|@||@||@|123","|@|");
		Date endDate=new Date();
		System.out.println("调用client.doPost结束时间："+endDate.toString());
		long between=endDate.getTime()-startDate.getTime();
		System.out.println("共用毫秒数："+between);
		System.out.println(list.size());
		for(int i=0;i<list.size();i++){
//			System.out.println(i+":"+list.get(i));
		}
		
	}
	


}
